"""
    Event controller.
"""

from mnemoply import model
from mnemoply.controllers.lookup import LookupController, TableCol, TableLookupDataSource
from mnemoply.controllers.crud import CRUDController

class EventController(LookupController, CRUDController):
    model_object = model.Event
    lookup_columns = [
        TableCol(name='date', caption=_('Date')),
        TableCol(name='office', caption=_('Office')),
        TableCol(name='trend', caption=_('Trend')),
        TableCol(name='number_of_employees', caption=_('Number of emlpoyees')),
        TableCol(name='number_of_clients', caption=_('Number of clients')),
    ]

    view_fields = [
        'date',
        'officeID',
        'trendID',
        'numberOfEmployees',
        'numberOfClients',
    ]

    def __init__(self):
        LookupController.__init__(self,
                                  data_source=TableLookupDataSource('event_lookup'),
                                  columns=self.lookup_columns,
                                  title=self.model_object.model_title,
                                  )
        CRUDController.__init__(self, model_object=self.model_object)

exposed = EventController()
